package com.project.ganyan;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.net.ParseException;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class GanyanActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    public void Calculate(View V)
    {
    	float value=1;
    	EditText tv1=(EditText)findViewById(R.id.editText1) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.editText1) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.editText2) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.editText3) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.editText4) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.editText5) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.editText6) ;
    	value *= CheckValue(tv1.getText().toString());
    	tv1=(EditText)findViewById(R.id.misli) ;
    	value *= CheckValue(tv1.getText().toString());
    	Dialog dialog = new Dialog(this);

    	dialog.setContentView(R.layout.dialog);
    	dialog.setTitle("Kupon Bedeli");

    	TextView text = (TextView) dialog.findViewById(R.id.dialog);
    	text.setText(String.valueOf(value));

    }
    protected float CheckValue(String temp)
    {
    	float x=1;
    	if (temp.equals(""))
    	{
    		return x;
    		
    	}
    	else
    	{
    		x=Float.parseFloat(temp);
    		return x;
    	}
    		
    	
    	
    	
    }
}